package com.laikan.reader.core.warm;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import com.laikan.reader.R;
import com.laikan.reader.bookfriend.activity.LoginActivity;

/**
 * Created by wx on 16/9/30.
 */
public class WarmWindow {

    private AlertDialog log;

    /**
     * 显示设置头像的对话框
     */
    public void showPickDialog(final Context context) {

        if (log == null) {
            log = new AlertDialog.Builder(context).setView(View.inflate(context, R.layout.alterdialog, null)).setNegativeButton("登录", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    Intent intent = new Intent(context, LoginActivity.class);
                    context.startActivity(intent);
                }
            }).setPositiveButton("取消", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).show();
        }else {
            log.show();
        }

    }
}
